import request from '@/utils/request'


export function generateGoodsSn() {
  return request({
    url: '/goods/generateGoodsSn',
    method: 'get'
  })
}

export function categoryl3() {
  return request({
    url: '/goods/categoryl3',
    method: 'get'
  })
}
export function updateGoods(data) {
  return request({
    url: '/goods/updateGoods',
    method: 'post',
    data
  })
}

export function listGoods(query) {
  return request({
    url: '/goods/list',
    method: 'get',
    params: query
  })
}
export function listpPutaway(query) {
  return request({
    url: '/goods/listpPutaway',
    method: 'get',
    params: query
  })
}

export function listShopGoods(query) {
  return request({
    url: '/goods/shopList',
    method: 'get',
    params: query
  })
}

export function listShopGoodsAll(query) {
  return request({
    url: '/goods/all',
    method: 'get',
    params: query
  })
}

export function listFilterGoodsByCategoryl3(query) {
  return request({
    url: '/goods/filterGoodsByCategoryl3',
    method: 'get',
    params: query
  })
}

export function deleteGoods(data) {
  return request({
    url: '/goods/delete',
    method: 'post',
    data
  })
}

export function publishGoods(data) {
  return request({
    url: '/goods/create',
    method: 'post',
    data
  })
}

export function detailGoods(id) {
  return request({
    url: '/goods/detail',
    method: 'get',
    params: { id }
  })
}

export function editGoods(data) {
  return request({
    url: '/goods/update',
    method: 'post',
    data
  })
}

export function listCatAndBrand() {
  return request({
    url: '/goods/catAndBrand',
    method: 'get'
  })
}

export function getGoodsLogs(query) {
  return request({
    url: '/goods/queryGoodsLogList',
    method: 'get',
    params: query
  })
}


export function approveGoods(data) {
  return request({
    url: '/goods/approve',
    method: 'post',
    data
  })
}

export function rejectGoods(data) {
  return request({
    url: '/goods/reject',
    method: 'post',
    data
  })
}

export function pushGoods(data) {
  return request({
    url: '/goods/push',
    method: 'put',
    data
  })
}

export function newProductGoods(data) {
  return request({
    url: '/goods/newProduce',
    method: 'put',
    data
  })
}

export function recommendGoods(data) {
  return request({
    url: '/goods/recommend',
    method: 'put',
    data
  })
}

export function updatePriceGoods(data) {
  return request({
    url: '/goods/updatePrice',
    method: 'put',
    data
  })
}

export function updateSpecPriceGoods(data) {
  return request({
    url: '/goods/updateSpecPrice',
    method: 'put',
    data
  })
}

export function getAllPriceGoods(query) {
  return request({
    url: '/goods/allPrice',
    method: 'get',
    params: query
  })
}


export function updateStoreGoods(data) {
  return request({
    url: '/goods/updateStore',
    method: 'put',
    data
  })
}

export function updateGoodsDiscountPrice(data) {
  return request({
    url: '/goods/updateDiscountPrice',
    method: 'put',
    data
  })
}

export function batchCreate(data) {
  return request({
    url: '/goods/batch',
    method: 'post',
    data
  })
}

export function readGoodsProduct(params) {
  return request({
    url: '/goods/readGoodsProduct',
    method: 'get',
    params: params
  })
}

export function updateGoodsProduct(data) {
  return request({
    url: '/goods/updateGoodsProduct',
    method: 'put',
    data
  })
}

export function addGoodsProduct(data) {
  return request({
    url: '/goods/addGoodsProduct',
    method: 'post',
    data
  })
}

export function goodsOps() {
  return request({
    url: '/goods/goodsOps',
    method: 'get',
  })
}

// 复制商品
export function goodsCopy(id) {
  return request({
    url: '/goods/copy',
    method: 'get',
    params: { id }
  })
}

// 增加商品规格
export function goodsAddSpec(data) {
  return request({
    url: '/goods/addSpec',
    method: 'post',
    data
  })
}

// 修改规格
export function goodsUpdateSpec(data) {
  return request({
    url: '/goods/updateSpec',
    method: 'post',
    data
  })
}

// 删除规格
export function goodsDeleteSpec(specId) {
  return request({
    url: '/goods/deleteSpec',
    method: 'get',
    params: { specId }
  })
}

// 添加规格原料
export function goodsAddSpecMer(data) {
  return request({
    url: '/goods/addSpecMer',
    method: 'post',
    data
  })
}

// 修改规格原料
export function goodsUpdateSpecMer(data) {
  return request({
    url: '/goods/updateSpecMer',
    method: 'post',
    data
  })
}

// 删除规格原料
export function goodsDeleteSpecMer(specMerId) {
  return request({
    url: '/goods/deleteSpecMer',
    method: 'get',
    params: { specMerId }
  })
}

// 规格原料列表
export function goodsSpecMerList(specId, merchandiseId) {
  return request({
    url: '/goods/specMerList',
    method: 'get',
    params: { specId, merchandiseId }
  })
}

// 辅料原料列表
export function goodsAccessoryMerList(accessoryId) {
  return request({
    url: '/goods/accessoryMerList',
    method: 'get',
    params: { accessoryId }
  })
}

// 添加辅料
export function goodsAddAccessory(data) {
  return request({
    url: '/goods/addAccessory',
    method: 'post',
    data
  })
}

// 修改辅料
export function goodsUpdateAccessory(data) {
  return request({
    url: '/goods/updateAccessory',
    method: 'post',
    data
  })
}

// 删除辅料
export function goodsDeleteAccessory(accessoryId) {
  return request({
    url: '/goods/deleteAccessory',
    method: 'get',
    params: { accessoryId }
  })
}

// 添加属性
export function goodsAddProp(data) {
  return request({
    url: '/goods/addProp',
    method: 'post',
    data
  })
}

// 修改属性
export function goodsUpdateProp(data) {
  return request({
    url: '/goods/updateProp',
    method: 'post',
    data
  })
}

// 删除属性
export function goodsDeleteProp(propertyId) {
  return request({
    url: '/goods/deleteProp',
    method: 'get',
    params: { propertyId }
  })
}

export function goodsOption(query) {
  return request({
    url: '/goods/option',
    method: 'get',
    params: query
  })
}
export function goodsAccessoryList(query) {
  return request({
    url: '/goodsAccessory/list',
    method: 'get',
    params: {groupName:query.groupName,goodsName:query.goodsName,name:query.name,page:query.page,limit:query.limit}
  })
}
export function goodsAccessoryRemove(query) {
  return request({
    url: '/goodsAccessory/remove',
    method: 'get',
    params: {id:query}
  })
}
export function goodsAccessoryBatchesRemove(data) {
  return request({
    url: '/goodsAccessory/batchesRemove',
    method: 'post',
    data
  })
}
